
import request from "@/utils/request";

// 接口返回结构固定
// data 的类型, 传进来
type Result<T = undefined> = {
    code: string,
    message: string,
    data: T
}


//  添加订单
export function addOrder(userid: string) {
    return request.post<any, Result>('/order/addOrder', {
        userid
    })
}

//  支付是删除购物车勾选的
export function deleteCartItem(userid: string) {
    return request.get<any, Result>('/order/deleteCartItem', {
        params: {
            userid
        }
    })
}



// 所有订单 
export function getOrderListApi(userid: any) {
    return request.get<
        any,
        Result<any>
    >('/user/orderlist', {
        params: {
            userid
        }
    })
}

//获取确认订单的信息

export function configmOrder(userid: string, time: string) {
    return request.get<any, Result>('/order/confirmOrder', {
        params: {
            userid,
            time
        }
    })
}



//修改订单的地址
export function updateOrderAddress(data: any) {
    return request.post<
        any,
        Result<any>
    >('/order/updateOrderAddress', data)
}
